<?php

include 'common.php';

/**
 * 这是一个用户实名的例子
 */
class userAuthRequest
{
    public $phone;
    public $idCardFrontContent;
    public $idCardFrontUrl;
    public $idCardBackContent;
    public $idCardBackUrl;

}

$req = new userAuthRequest();
$req->phone = "13905710441";
$req->idCardFrontUrl = "http://127.0.0.1/query/idcard/idcardfront.jpg";
$req->idCardBackUrl = "http://127.0.0.1/query/idcard/idcardfront.jpg";

$json = json_encode($req, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

$publicReq = new publicRequesrt();
$publicReq->bizContent = $json;
$publicReq->charset = "utf-8";
$publicReq->companyId = "1005";
$publicReq->signType = "RSA2";
$publicReq->timestamp = "2023-12-04 09:15:10";


$json = json_encode($req, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

$publicReqSign = "bizContent=$json&charset=$publicReq->charset&companyId=$publicReq->companyId&signType=$publicReq->signType&timestamp=$publicReq->timestamp";

$rsa2 = RsaSign($publicReqSign);

$publicReq->sign = $rsa2;

$publicReqBody = json_encode($publicReq, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

echo "请求报文: $publicReqBody \r\n";

http_post("https://api.kylin-task.com/api/kycloud/open/v1.0/auth", $publicReqBody);
